package com.neusoft.neuiotms.dcom.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "neuiot_knowledge_comment")
@org.hibernate.annotations.Table(appliesTo = "neuiot_knowledge_comment", comment = "知识库评论")
public class KnowledgeComment extends AbstractAuditModel {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "评论人编码")
    @Length(max = 255, message = "评论人编码不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '评论人编码'")
    private String userCode;

    @Length(max = 255, message = "评论人名称不能超过{max}位")
    @Column(length = 255, nullable = true)
    @Comment("varchar(255) NULL COMMENT '评论人名称'")
    private String userName;

    @Lob
    @Column(columnDefinition = "longtext")
    @Comment("longtext COMMENT '评论内容'")
    private String content;

    @Column(length = 32, nullable = true)
    @Comment("int(32) NULL COMMENT '赞同数'")
    private Integer approve = 0;

    @Column(length = 32, nullable = true)
    @Comment("int(32) NULL COMMENT '反对数'")
    private Integer opposition = 0;

    @ManyToOne
    private Knowledge knowledge;

}
